<!--检测任务列表-->
<template>
	<view>
		<!-- <Listscroll requestUrl="/app/app-mine/device-warning" :params="params" requestType="post">
			<template #default="scope"> -->
				<view class="notice-item" v-for="(item,i) in  testTaskList" :key="i" >
					<view class="notice-item__title" @click="testTaskInformation(item)">
						<view class="title">{{item.taskName}}</view>
					</view>
					<!-- <view class="operation-button">
						<view class="up-button" @click="editTask"></view>
						<view class="edit-button" @click="editTask"></view>
						<view class="delete-button" @click="deleteTask"></view>
					</view> -->
					<view class="notice-item__containter">共有{{item.totalNum}}个组件</view>
				</view>
			<!-- </template>
		</Listscroll> -->
	</view>
</template>

<script setup>
import {ref} from "vue"
import Listscroll from "@/components/list-scroll/list-scroll.vue"
import {
	    onLoad,
	  } from "@dcloudio/uni-app";
import {examProgress } from '@/api/deviceTest.js';
const params = ref({})
const enterPrise = ref("")
const testTaskList = ref([])
// onLoad 接受 跳转过来 页面传递的参数
	  onLoad((option) => {
	   let year = JSON.parse(option.info).year;
	   let season = JSON.parse(option.info).season;
	   let userId = JSON.parse(option.info).userId;
       getTestTaskList(
	   {
		   year:year,
		   season:season,
		   userId:userId   
	   });
	  });
	  const testTaskInformation = (item) => {
		  console.log("进入检测任务详情页面");
		  uni.navigateTo({
		  			   url: '/pages/testing/taskInformation?info='+ encodeURIComponent(JSON.stringify(item))
		  			});
	  }
	  //获取测试任务列表
	  const getTestTaskList =(data) =>{
		  examProgress(data).then(res => {
		  	//console.log('fffffff', res);
			testTaskList.value = res.data;
		  	// let tempData = {value:"",text:""};
		  	// if(res.code == 200){
		  	// res.data.forEach(item => {
		  	// 	tempData.value = item.factoryId;
		  	// 	tempData.text = item.factoryName;
		  	// 	enterpriseList.value.push(tempData);
		  	// })
		  	// }
		  })
	  }
</script>

<style lang="scss" scoped>
.notice-item {
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: 10rpx;
	margin: 20rpx 30rpx 0 30rpx;
	padding: 20rpx;
	//cursor: pointer;
	position: relative;
}
.notice-item__title {
	display: flex;
	justify-content: space-between;
	margin-bottom: 10rpx;
	.title {
		font-weight: bold;
		font-size: 28rpx;
		color: #455BDF;
		cursor: pointer;
	}
	.type {
		display: inline-block;
		padding: 4rpx 8rpx;
		background: #fef0f0;
		border:2rpx solid #fde2e2;
		color: rgb(251, 69, 59);
		border-radius: 10rpx;
		font-size: 20rpx;
		&.green{
			background: #f0f9eb;
			border-color:#e1f3d8;
			color: #67c23a;
		}
	}
}
.notice-item__containter {
	text-overflow: -o-ellipsis-lastline;
	overflow: hidden;
	text-overflow: ellipsis;
	display: flex;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	font-size: 28rpx;
}
.operation-button{
	position: absolute;
	right:30rpx;
	display: flex;
	flex-direction: row;
	.edit-button{
		width:32rpx;
		height:32rpx;
		background-image:url('@/static/deviceImg/edit-button.png') ;
		background-size: 100% 100%;
		cursor: pointer;
		//width:40rpx;
		// height:30rpx;
		// display: inline-block;
		// padding: 4rpx 8rpx;
		// background: #00aaff;
		// border:2rpx solid #00aaff;
		// color: #ffffff;
		// border-radius: 10rpx;
		// font-size: 20rpx;
		margin-left: 10rpx;
	}
	.delete-button{
		width:32rpx;
		height:32rpx;
		background-image:url('@/static/deviceImg/delete-button.png') ;
		background-size: 100% 100%;
		margin-left: 10rpx;
		cursor: pointer;
		//width:40rpx;delete-button.png
		// height:30rpx;
		// margin-left: 10rpx;
		// display: inline-block;
		// padding: 4rpx 8rpx;
		// background: #fef0f0;
		// border:2rpx solid #fde2e2;
		// color: rgb(251, 69, 59);
		// border-radius: 10rpx;
		// font-size: 20rpx;
	}
	.up-button{
		width:32rpx;
		height:32rpx;
		background-image:url('@/static/deviceImg/up-button.png') ;
		background-size: 100% 100%;
		cursor: pointer;
		// display: inline-block;
		// padding: 4rpx 8rpx;
		// background: #00aaff;
		// border:2rpx solid #00aaff;
		//color: #ffffff;
		// border-radius: 10rpx;
		// font-size: 20rpx;
	}
}
</style>
